<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dessert House - 会员</title>
<link href="/ChristineCake/css/Goods.css" rel="stylesheet"
	type="text/css" />
</head>

<body>

	<div id="header">
		<div id="logo">
			<img src="/ChristineCake/image/logo.png" alt="logo" width="100%"
				height="100%" />
		</div>
		<div id="logout" align="right">
			<a href="/ChristineCake/jsp/LogIn.jsp">登出</a>
		</div>
	</div>

	<div id="menu">
		<ul>
			<li><a
				href="
			<%out.println("/ChristineCake/OrderGoodsServlet?name="
					+ request.getParameter("name") + "&date=day1");%>
			">预定</a></li>
			<li><a
				href="
			<%out.println("/ChristineCake/OrderListServlet?name="
					+ request.getParameter("name"));%>
			">购物车</a></li>
			<li><a
				href="
			<%out.println("/ChristineCake/ConsumptionRecordServlet?name="
					+ request.getParameter("name"));%>
			">消费记录</a></li>
			<li><a
				href="
			<%out.println("/ChristineCake/MemberMessageManagementServlet?name="
					+ request.getParameter("name"));%>
			">账户管理</a></li>
		</ul>
	</div>

	<div id="content">
		<jsp:directive.page import="java.sql.Date" />
		<jsp:directive.page import="java.util.Calendar" />
		<form method="GET" action="/ChristineCake/OrderGoodsServlet">
			日期：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <select name="date">
				<%
					Date date = new Date(Calendar.getInstance().getTimeInMillis());
					out.println("<option value=\"day1\"");
					if (request.getParameter("date").equals("day1")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day2\"");
					if (request.getParameter("date").equals("day2")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day3\"");
					if (request.getParameter("date").equals("day3")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day4\"");
					if (request.getParameter("date").equals("day4")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day5\"");
					if (request.getParameter("date").equals("day5")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day6\"");
					if (request.getParameter("date").equals("day6")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
					date = new Date(date.getTime() + 24 * 3600000L);
					out.println("<option value=\"day7\"");
					if (request.getParameter("date").equals("day7")) {
						out.println(" selected=\"true\">");
					} else {
						out.println(">");
					}
					out.println(date);
					out.println("</option>");
				%>
			</select> &nbsp;&nbsp; <input type="submit" name="chooseDate" value="确定"
				size="20%" class="button"> <input type="hidden" name="name"
				value="
				<%out.println(request.getParameter("name"));%>
				">
		</form>
	</div>
	<jsp:useBean id="goodsList" type="bean.GoodsListBean" scope="request" />
	<jsp:useBean id="goods" class="model.Goods" scope="page" />
	<%
		int count = goodsList.getGoodsList().size();
		out.println("<div id=\"panel\" style=\"height:" + 400*((count-1)/3+1) + "px\">");
		if (count == 0) {
			out.println("这一天暂时没有可以预定的商品哦~");
		} else {
			for (int i = 0; i < count; i++) {
				out.println("<div class=\"content\">");
				out.println("<img src=\"/ChristineCake/image/"
						+ goodsList.getGoods(i).getId()
						+ ".jpg\" width=\"100%\" height=\"300px\" />");
				out.println(goodsList.getGoods(i).getName()
						+ "&nbsp;&nbsp;" + goodsList.getGoods(i).getPrice()
						+ "元<br />");
				out.println("<div class=\"submit\">");
				out.println("<a href=\"/ChristineCake/OrderMessageServlet?id="
						+ goodsList.getGoods(i).getId()
						+ "&name="
						+ request.getParameter("name")
						+ "&date="
						+ goodsList.getGoods(i).getDate() + "\">预定 </a>");
				out.println("</div></div>");
			}
		}
		out.println("</div>");
	%>

	<hr />

	<div id="footer">
		<p>©南京大学软件学院 李冰洁</p>
	</div>

</body>

</html>